package 草稿包;

public class leetcode {
    public static void main(String[] args) {
//    Solution solution=new Solution();
//    int[] nums={1};
//    int target=1;
//    solution.searchRange(nums,target);
        System.out.println(1);

    }
}


class Solution {
    public int besearch_l(int[] nums,int l,int r,int k){
        while(l<r){
            int mid=l+r>>1;
            if(k<=nums[mid])r=mid;
            else l=mid+1;
        }
        return l;
    }

    public int besearch_r(int[] nums,int l,int r,int k){
        while(l<r){
            int mid=l+r+1>>1;
            if(k<nums[mid])r=mid-1;
            else l=mid;
        }
        return l;
    }
    public int[] searchRange(int[] nums, int target) {
        int[] res=new int[2];
        if(nums.length==0){
            res[0]=res[1]=-1;
            return res;
        }

        res[0]=besearch_l(nums,0,nums.length,target);
        res[1]=besearch_r(nums,0,nums.length,target);

        if(nums[res[0]]!=target){
            res[0]=res[1]=-1;
        }
        return res;
    }
}
